package fni;

/**
 * Created by Veronica on 2017/4/7.
 */

/*java抽象类*/
abstract class Abs{
    private int age;
    public void tell(){

    }
    //抽象方法
    public abstract void say();
    public abstract void print();

    public void setAge(int age) {
        this.age = age;
    }

    public int getAge() {
        return age;
    }
}

class AbsDemo extends Abs{ //抽象类被子类继承，子类（如果不是抽象类）必须重写抽象类中的所有抽象方法
    public void say(){
        System.out.println(getAge());
    }

    @Override
    public void print() {

    }
}

public class AbsDemo01 {
    public static void main(String[] args) {
//        Abs = new Abs();
        AbsDemo a = new AbsDemo();
        a.setAge(20);
        a.say();
        a.print();

    }
}
